{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Exporting citations associated with a PMIDor list of PMIDs\n",
    "\n",
    "He we export EndNote/BibTex citations from a PMID or a list of PMIDs. If you need to search Entrez/PubMed and save the results as citations, refer to Examples/pubmed_search_and_save.jl\n",
    "\n",
    "Authors: Isabel Restrepo <br>\n",
    "BCBI - Brown University <br>\n",
    "Version: Julia 0.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: Method definition ==(Base.Nullable{S}, Base.Nullable{T}) in module Base at nullable.jl:238 overwritten in module NullableArrays at /Users/isa/.julia/v0.6/NullableArrays/src/operators.jl:99.\n"
     ]
    }
   ],
   "source": [
    "using BioMedQuery.Processes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "results_dir = \"./results\"\n",
    "\n",
    " if !isdir(results_dir)\n",
    "     mkdir(results_dir)\n",
    " end\n",
    "\n",
    "pmid = 11748933\n",
    "pmid_list = [24008025, 24170597];"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Export as EndNote library file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Saving citation for 2 articles\n",
      "Saving citation for 2 articles\n"
     ]
    }
   ],
   "source": [
    "enw_file=results_dir*\"/11748933.enw\"\n",
    "export_citation(pmid, \"endnote\", enw_file)\n",
    "enw_file = results_dir* \"/pmid_list.enw\"\n",
    "export_citation(pmid_list, \"endnote\", enw_file);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Explore one of the output files"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%0 Journal Article\n",
      "%A Vega-Robledo, GB\n",
      "%A Valencia-Zavala, MP\n",
      "%A Sánchez-Olivas, M\n",
      "%A Velázquez-Sámano, G\n",
      "%A Rico-Rosillo, G\n",
      "%D 2012\n",
      "%T [Association of obesity in adults with allergic asthma].\n",
      "%J Rev Alerg Mex\n",
      "%V 59\n",
      "%N 4\n",
      "%P 173-9\n",
      "%M 24008025\n",
      "%U http://www.ncbi.nlm.nih.gov/pubmed/24008025\n",
      "%X BACKGROUND: Obesity and asthma are diseases of high prevalence around the world. The increment in their incidence constitutes a challenge to public health. Asthma can be worse in patients with obesity. OBJECTIVE: To know the prevalence of obesity in a group of Mexican allergic asthmatic adults. METHODS: A study about the prevalence of obesity in 158 adult asthmatic allergic patients in the years 2010 and 2011 was performed, according to the body mass index (BMI) obtained from their clinical files. In addition, skin tests with allergens were done and the total serum level of IgE was determined in each one of the individuals. RESULTS: According to the BMI, 112 (70.9%) patients had a weight above normal; 76 (67.9%) were women and 36 (32.1%) were men. The highest number of patients with weight above normal corresponded to the overweight group. Mild persistent asthma presented in two-thirds of the patients with overweight and obesity. Women with overweight and obesity showed a higher severity of asthma than men. Women had more positive skin tests than men. Half of the patients had IgE levels above normal. CONCLUSIONS: We found an increased prevalence of asthmatic adults with associated obesity. Asthmatic women presented more overweight and obesity than men, as well as increased severity of asthma and more positive skin tests with allergens. \n",
      "%K Adult\n",
      "%K Allergens\n",
      "%K Asthma\n",
      "%K Body Mass Index\n",
      "%K Humans\n",
      "%K Obesity\n",
      "%K Overweight\n",
      "%+ Departamento de Medicina Experimental, Torre de InvestigaciÛn,5∞ piso, Facultad de Medicina, UNAM, MÈxico D.F.\n",
      "\n",
      "%0 Journal Article\n",
      "%A Rogge, MM\n",
      "%A Merrill, E\n",
      "%D 2012\n",
      "%T Obesity education for nurse practitioners: perspectives from nurse practitioner faculty.\n",
      "%J J Am Assoc Nurse Pract\n",
      "%V 25\n",
      "%N 6\n",
      "%P 320-8\n",
      "%M 24170597\n",
      "%U http://www.ncbi.nlm.nih.gov/pubmed/24170597\n",
      "%X PURPOSE: The purpose of the study was to investigate curriculum content and teaching practices about obesity in graduate nursing programs in the United States. METHODOLOGY: A survey of 1202 faculty members teaching in nurse practitioner (NP) programs was conducted using an investigator-created instrument with items based on the National Institutes of Health Obesity Education Initiative guidelines. Objective items were analyzed using descriptive and nonparametric statistics, and the open-ended questions were analyzed using content analysis. FINDINGS: NP faculty emphasized existing clinical practice guidelines, but revealed a large disparity between what is emphasized in schools of nursing and the state of the science regarding obesity etiology and management. Faculty place a priority on teaching obesity as a key factor in the development of comorbidities, and weight loss as a means of treating these comorbidities. Teaching about the pathophysiology of obesity, management of bariatric surgery patients, and pharmacologic therapy are de-emphasized. Four main themes about obesity teaching practices were identified from subjects' comments to open-ended items. CONCLUSIONS: Additional education and support are needed for faculty to teach about obesity in a way that advances the care of obese patients based on emerging scientific principles. \n",
      "%K Attitude of Health Personnel\n",
      "%K Clinical Competence\n",
      "%K Curriculum\n",
      "%K Education, Nursing, Graduate\n",
      "%K Faculty, Nursing\n",
      "%K Humans\n",
      "%K Nurse Practitioners\n",
      "%K Obesity\n",
      "%K United States\n",
      "%+ Anita Thigpen Perry School of Nursing, Texas Tech University Health Sciences Center, Lubbock, Texas.\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "println(readstring(enw_file))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Export as a Bibtex file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Saving citation for 2 articles\n",
      "Saving citation for 2 articles\n"
     ]
    }
   ],
   "source": [
    "bib_file=results_dir*\"/11748933.bib\"\n",
    "export_citation(pmid, \"bibtex\", bib_file)\n",
    "bib_file = results_dir* \"/pmid_list.bib\"\n",
    "export_citation(pmid_list, \"bibtex\", bib_file);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Explore one of the output files"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "@article {PMID:24008025,\n",
      "  author  = {Vega-Robledo, GB and Valencia-Zavala, MP and Sánchez-Olivas, M and Velázquez-Sámano, G and Rico-Rosillo, G},\n",
      "  title   = {[Association of obesity in adults with allergic asthma].},\n",
      "  journal = {Rev Alerg Mex},\n",
      "  year    = {2012},\n",
      "  volume  = {59},\n",
      "  number  = {4},\n",
      "  pages   = {173-9},\n",
      "  url     = {http://www.ncbi.nlm.nih.gov/pubmed/24008025},\n",
      "}\n",
      "\n",
      "\n",
      "@article {PMID:24170597,\n",
      "  author  = {Rogge, MM and Merrill, E},\n",
      "  title   = {Obesity education for nurse practitioners: perspectives from nurse practitioner faculty.},\n",
      "  journal = {J Am Assoc Nurse Pract},\n",
      "  year    = {2012},\n",
      "  volume  = {25},\n",
      "  number  = {6},\n",
      "  pages   = {320-8},\n",
      "  url     = {http://www.ncbi.nlm.nih.gov/pubmed/24170597},\n",
      "}\n",
      "\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "println(readstring(bib_file))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 0.6.0",
   "language": "julia",
   "name": "julia-0.6"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "0.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
